﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Forecast.Domain.Implementation
{
    class AcceptOfferService : IAcceptOffers
    {
        public void Execute(IPlay acceptor, IOffer offer)
        {
            if (acceptor == null)
                throw new ArgumentNullException("acceptor");
            if (offer == null)
                throw new ArgumentNullException("offer");
            if (!offer.IsActive)
                throw new ApplicationException("Can't accept the offer because it is not active any longer.");

            IAcceptOffers acceptOfferService = AcceptOfferServiceFactory.GetAcceptOfferService(offer);
            acceptOfferService.Execute(acceptor, offer);
        }
    }
}
